from tools.mysqlconntool import mysqlconn

table_name = 'ratings'  # 替换为你的表名

def read():
    sql = 'SELECT * FROM ratings ORDER BY id DESC'
    users = mysqlconn.sql_select(sql)
    return users

def id_delete(id):
    record_id = id  # 替换为要删除的记录 ID
    count = mysqlconn.delete_record(table_name, record_id)
    return count

def add(data):
    count = mysqlconn.insert_record(table_name, data)
    return count

def update(data, id):
    count = mysqlconn.update_record(table_name, id, data)
    return count
